home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / src / machserver / 1.098 / libc / Quad_CompareUns.c < prev    next >
C/C++ Source or Header  |  1991-03-18  |  2KB  |  56 lines

  1. /* 
  2.  * Quad_CompareUns.c --
  3.  *
  4.  *    Quad_CompareUns libc routine.
  5.  *
  6.  * Copyright 1991 Regents of the University of California
  7.  * Permission to use, copy, modify, and distribute this
  8.  * software and its documentation for any purpose and without
  9.  * fee is hereby granted, provided that this copyright
  10.  * notice appears in all copies.  The University of California
  11.  * makes no representations about the suitability of this
  12.  * software for any purpose.  It is provided "as is" without
  13.  * express or implied warranty.
  14.  */
  15.  
  16. #ifndef lint
  17. static char rcsid[] = "$Header: /sprite/src/lib/c/quad/RCS/Quad_CompareUns.c,v 1.1 91/03/18 12:19:57 kupfer Exp $ SPRITE (Berkeley)";
  18. #endif /* not lint */
  19.  
  20. #include <quad.h>
  21.  
  22.  
  23. /*
  24.  *----------------------------------------------------------------------
  25.  *
  26.  * Quad_CompareUns --
  27.  *
  28.  *    General comparison of two unsigned quads.
  29.  *
  30.  * Results:
  31.  *    1 if the first value is greater than the second, 0 if they're 
  32.  *    the same, -1 if the first value is less.
  33.  *
  34.  * Side effects:
  35.  *    None.
  36.  *
  37.  *----------------------------------------------------------------------
  38.  */
  39.  
  40. int
  41. Quad_CompareUns(q1Ptr, q2Ptr)
  42.     u_quad *q1Ptr, *q2Ptr;    /* pointers to the two arguments */
  43. {
  44.     if (q1Ptr->val[QUAD_MOST_SIG] > q2Ptr->val[QUAD_MOST_SIG]) {
  45.     return 1;
  46.     } else if (q1Ptr->val[QUAD_MOST_SIG] < q2Ptr->val[QUAD_MOST_SIG]) {
  47.     return -1;
  48.     } else if (q1Ptr->val[QUAD_LEAST_SIG] > q2Ptr->val[QUAD_LEAST_SIG]) {
  49.     return 1;
  50.     } else if (q1Ptr->val[QUAD_LEAST_SIG] < q2Ptr->val[QUAD_LEAST_SIG]) {
  51.     return -1;
  52.     } else {
  53.     return 0;
  54.     }
  55. }
  56.